package com.jzw.zhiweijin.lab;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.andview.refreshview.recyclerview.BaseRecyclerAdapter;

import java.util.ArrayList;

/**
 * Created by zhiweijin on 16-5-11.
 */
public class SimpleAdapter extends BaseRecyclerAdapter {
    private Context mContext;
    private ArrayList<String> mList;
    private LayoutInflater mLayoutInflate;

    public static enum ITEM_KEY{
        HENG,
        TU
    }


    public SimpleAdapter(Context mContext, ArrayList<String> mList) {
        this.mContext = mContext;
        this.mList = mList;
        mLayoutInflate=LayoutInflater.from(mContext);
    }

    @Override
    public RecyclerView.ViewHolder getViewHolder(View view) {
        return new SimpleHodler(view,true);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType, boolean isItem) {
//        if (viewType==ITEM_KEY.HENG.ordinal()){
//            return new SimpleHengHodler(mLayoutInflate.inflate(R.layout.item_hengmingshi,parent,false),true);
//        } else {
            return new SimpleHodler(mLayoutInflate.inflate(R.layout.item_mingpin,parent,false),true);

//        }


    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, boolean isItem) {
        if (holder instanceof SimpleHengHodler){

        }else {

        }

    }

    @Override
    public int getAdapterItemCount() {
        return mList==null?0:mList.size();
    }

    @Override
    public int getAdapterItemViewType(int position) {
//        if (position==0){
//            return ITEM_KEY.HENG.ordinal();
//        }else
        return ITEM_KEY.TU.ordinal() ;
    }

    public class SimpleHodler extends RecyclerView.ViewHolder{

        public SimpleHodler(View itemView,boolean isItem) {
            super(itemView);


        }
    }
    public class SimpleHengHodler extends RecyclerView.ViewHolder{

        public SimpleHengHodler(View itemView,boolean isItem) {
            super(itemView);


        }
    }
}
